package jmine.tec.web.front.dispatcher.request;

import jmine.tec.annotations.Unmodifiable;
import jmine.tec.web.front.domain.BackOfficeRequestRevision;
import bancosys.tec.persist.persister.listener.AbstractPersisterListener;

/**
 * Listener of back office revision persistence events
 * 
 * @author lundberg
 */
@Unmodifiable
public class BackOfficeRequestRevisionPersisterListener extends AbstractPersisterListener<BackOfficeRequestRevision> {

    private BackOfficeRequestLifecycle lifecycle;

    /**
     * Constructor
     * 
     * @param lifecycle lifecycle
     */
    public BackOfficeRequestRevisionPersisterListener(BackOfficeRequestLifecycle lifecycle) {
        super();
        this.lifecycle = lifecycle;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected void afterInsert(BackOfficeRequestRevision bean) {
        super.beforeInsert(bean);
        this.lifecycle.process(bean.getRequest());
    }
}
